#ifndef JMESSAGENOTIFIER_H
#define JMESSAGENOTIFIER_H

#include <QTECore/qteglobal.h>
#include <QObject>

#ifndef QTE_interface_register
# define QTE_interface_register(Type, name, ...) \
	QTE_type_register(Type, name, __VA_ARGS__)
#endif

#ifndef QTE_interface_register_id
# define QTE_interface_register_id(Type, user_id, ...) \
	QTE_type_register(Type, "ClassName_"#user_id, __VA_ARGS__)
#endif

namespace QTE
{

class JMessageNotifierPrivate;

class QTECORE_EXPORT JMessageNotifier : public QObject
{
	Q_OBJECT

public:
	explicit JMessageNotifier(QObject *parent = nullptr);
	virtual ~JMessageNotifier() = 0;

public:
	static JMessageNotifier *create(const QString &className, QObject *parent = nullptr);
	static JMessageNotifier *create(quint32 user, QObject *parent = nullptr);
	virtual QString serviceName() const;

Q_SIGNALS:
	void notify(const QVariant &message);

private:
	JMessageNotifierPrivate *d_ptr;
};

inline JMessageNotifier *JMessageNotifier::create(quint32 user, QObject *parent)
{ return create(QString("ClassName_%1").arg(user), parent); }

} //namespace QTE


#endif //JMESSAGENOTIFIER_H
